package com.siam.package_promotion.feign;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import com.siam.package_common.entity.BasicResult;
import com.siam.package_promotion.entity.DeductionMemberRelation;
import com.siam.package_promotion.service.DeductionMemberRelationService;

@RestController
public class DeductionMemberRelationFeignProvider implements DeductionMemberRelationFeignApi{
	
	@Autowired
	private DeductionMemberRelationService memberRelationService;
	
	@Override
	public BasicResult insertSelective(DeductionMemberRelation memberRelation) {
		memberRelationService.insertSelective(memberRelation);
		return BasicResult.success();
	}

	@Override
	public BasicResult<Integer> getCountsByMemberId(Integer memberId, Integer isUsed) {
		Integer counts = memberRelationService.getCountsByMemberId(memberId, isUsed);
		return BasicResult.success(counts);
	}

	@Override
	public BasicResult<DeductionMemberRelation> selectNotUsedByDeductionMemberRelationId(Integer deductionMemberRelationId) {
		DeductionMemberRelation memberRelation = memberRelationService.selectNotUsedByDeductionMemberRelationId(deductionMemberRelationId);
		return BasicResult.success(memberRelation);
	}

	@Override
	public BasicResult updateDeductionUsed(Integer id, Boolean isUsed) {
		memberRelationService.updateDeductionUsed(id, isUsed);
		return BasicResult.success();
	}

}
